/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pap.repositorios;

import com.myapp.struts.Veiculos;
import java.util.Iterator;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;


public class RepositorioVeiculosTeste {

    private Veiculos veiculosDb;
    @PersistenceContext
    EntityManager em;
    
    public RepositorioVeiculosTeste() {
        this.veiculosDb = new Veiculos();
    }
    
     public void procurarVeiculo(){
     
        List lista = em.createNamedQuery("Veiculos.findByIdVeiculo").getResultList();
        Iterator it= lista.iterator();
        
        while(it.hasNext()){
            System.out.println(it.next().toString());
        }
    }
     
     public static void main(String args[]){
         RepositorioVeiculosTeste rep = new RepositorioVeiculosTeste();
         rep.procurarVeiculo();
     }
    
    
}
